package com.settlement.system.model.entity.common;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.converter.BillCategoryConvert;
import com.settlement.system.converter.InUseOrNotConvert;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;
import java.util.Date;

/**
 * RR-账单类型
 * @author xiaochuan
 * @since 2022-12-12
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblRrBillType extends BaseModel implements Serializable {


    /**
     * 账单大类
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "账单大类",converter = BillCategoryConvert.class)
    @ApiModelProperty(value = "账单大类（1、平台账单，2、营销工具，3、手工调账）")
    @NotBlank(message = "账单大类不能为空")
    @Pattern(regexp="^[1-3]{1}$",message="【账单大类】的值只能为 [平台账单]、[营销工具]或[手工调账]")
    private String billCategory;

    /**
     * 账单类型
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "账单类型")
    @ApiModelProperty(value = "账单类型")
    @NotBlank(message = "账单类型不能为空")
    private String billType;

    /**
     * 账单类型编码
     */
    @ApiModelProperty(value = "账单类型编码")
    private String code;

    /**
     * 状态（1启用，0禁用）
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "状态",converter = InUseOrNotConvert.class)
    @ApiModelProperty(value = "状态（1启用，0禁用）")
    @NotBlank(message = "状态不能为空")
    @Pattern(regexp="^[0-1]{1}$",message="【状态】的值只能为 [启用]、[禁用]")
    private String status;


    /**
     * 创建人
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "创建人")
    @ApiModelProperty(hidden = true)
    public String createUser;

    /**
     * 创建时间
     */
    @ColumnWidth(22)
    @ExcelProperty(value = "创建时间")
    @ApiModelProperty(hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date createTime;

    /**
     * 更新人
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "更新人")
    @ApiModelProperty(hidden = true)
    public String updateUser;

    /**
     * 更新时间
     */
    @ColumnWidth(22)
    @ExcelProperty(value = "更新时间")
    @ApiModelProperty(hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date updateTime;

    @Override
    public String toString() {
        return "TblRrBillType{" +
                "billCategory='" + billCategory + '\'' +
                ", billType='" + billType + '\'' +
                '}';
    }
}
